#include<iostream>
#include<Windows.h>
using namespace std;
int main_forfor()
{//嵌套循环中使用break
	SetConsoleOutputCP(65001);
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			if (j == 5)
			{
				break;
			}
			cout << "* ";
		}
		cout << endl;
	}
	system("pause");
	return 0;
}
int main_for()
{//for循环中使用break
	SetConsoleOutputCP(65001);
	for (int i = 0; i < 10; i++)
	{
		if (i == 5)
		{
			break;
		}
		cout << "i = " << i << endl;
	}
	system("pause");
	return 0;
}
int main_switch()
{//switch中使用break
	SetConsoleOutputCP(65001);
	cout << "请选择级别" << endl;
	cout << "简单：1，普通：2，困难：3" << endl;
	int select = 0;
	cin >> select;
	switch (select)
	{
	case 1:
		cout << "您选择了简单级别" << endl;
		break;
	case 2:
		cout << "您选择了普通级别" << endl;
		break;
	case 3:
		cout << "您选择了困难级别" << endl;
		break;
	default:
		cout << "您选择的级别不存在" << endl;
		break;
	}
	system("pause");
	return 0;
}